package com.sino.operation.service.impl;

import com.sino.operation.dto.inner.TaskQueue;
import com.sino.operation.dto.out.NetHandleEntity;
import com.sino.operation.entity.BizTranslist;
import com.sino.operation.mapper.BizTranslistMapper;
import com.sino.operation.service.BizTranslistService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;

/**
 * <p>
 * 流水表 服务实现类
 * </p>
 *
 * @author admin
 * @since 2021-10-07
 */
@Service
public class BizTranslistServiceImpl extends ServiceImpl<BizTranslistMapper, BizTranslist> implements BizTranslistService {

    @Autowired(required = false)
    private BizTranslistMapper mapper;


    /**
     * @param tellerNo
     * @return java.lang.String
     * @description {根据网点柜员号获取流水号}
     * @author 北陈
     * @date 2021/10/16 0016 20:25
     **/
    @Override
    public synchronized String getJournalNo(String tellerNo) {
        String sequence = mapper.getSequence();
        Integer i = Integer.parseInt(sequence);
        i = i + 1;
        String nowDay = LocalDateTime.now().format(DateTimeFormatter.BASIC_ISO_DATE);
        String journalNo = "BPR" + tellerNo + nowDay + sequence.format("%05d", i);
        return journalNo;
    }

    @Override
    public int getTransListByNetHandleCount(String tellerNo, String start, String end, String printNum, String kernelNo, String journalNo, String transState, String orgCode) {
        return mapper.getTransListByNetHandleCount(tellerNo, start, end, printNum, kernelNo, journalNo, transState, orgCode);
    }

    @Override
    public List<NetHandleEntity> getTransListByNetHandleList(String tellerNo, String start, String end, String printNum, String kernelNo, String journalNo, String transState, String orgCode) {
        return mapper.getTransListByNetHandleList(tellerNo, start, end, printNum, kernelNo, journalNo, orgCode, transState);
    }

    @Override
    public int getTransListForNetHandleCount(String tellerCode, String taskNo, String startTime, String endTime, String taskStatus, String transType, String centerNo) {
        return mapper.getTransListForNetHandleCount(tellerCode, taskNo, startTime, endTime, taskStatus, transType, centerNo);
    }

    @Override
    public List<TaskQueue> getTransListForNetHandleList(String tellerCode, String taskNo, String startTime, String endTime, String taskStatus, String transType, String centerNo) {
        return mapper.getTransListForNetHandleList(tellerCode, taskNo, startTime, endTime, taskStatus, transType, centerNo);
    }
}
